<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">

	<h:panelGroup id="headerLogin" layout="block">

		<!-- not logged -->

		<form id="loginForm"
			action="#{request.contextPath}/j_spring_security_check" method="post">
			<h:panelGroup rendered="#{!loginBean.isLogged()}">

				<h:outputText value="#{messages['login.usernameColon']}" />
				<h:inputText id="j_username" name="j_username"
					value="#{loginBean.login}" required="true"
					requiredMessage="#{messages['login.requiredUsername']}" />
				<br />
				<h:outputText value="#{messages['login.passwordColon']}" />
				<h:inputSecret id="j_password" name="j_password"
					value="#{loginBean.password}" required="true"
					requiredMessage="#{messages['login.requiredPassword']}" />
				<br />
				<button name="submit" type="submit">Přihlasit</button>

			</h:panelGroup>
		</form>

		<!-- is logged -->

		<h:panelGroup rendered="#{loginBean.isLogged()}">
			<h:form>
				<h:outputText value="#{loginBean.loggedUsername}" />
				<br />
				<h:outputLink value="#{request.contextPath}/views/admin-profile.jsf">Profil</h:outputLink>				
				<br />
				<h:outputLink value="#{request.contextPath}/views/messagein.jsf">Zprávy</h:outputLink>
			</h:form>

			<form action="#{request.contextPath}/j_spring_security_logout">
				<input type="submit" value="Logout" />
			</form>

		</h:panelGroup>

	</h:panelGroup>

</ui:composition>